#ifndef OOBB2_H
#define OOBB2_H

#include "Vec2.h"

#include <D3DX11.h>
#include <xnamath.h>

struct BoxPoints2
{
	BoxPoints2()
	{
		corners[0] = Vec2f(0, 0);
		corners[1] = corners[0];
		corners[2] = corners[0];
		corners[3] = corners[0];
	}
	Vec2f corners[4];
};

struct OOBB2
{
	BoxPoints2 bp;
	OOBB2(){}
	OOBB2(Vec2f mp, Vec2f ax[], float ex[])
	{
		axis[0] = ax[0];
		axis[1] = ax[1];
		axis[0].Normalise();
		axis[1].Normalise();

		centre = mp;
		extents[0] = ex[0];
		extents[1] = ex[1];
	}
	OOBB2(Vec2f mp, Vec2f ax1, Vec2f ax2, float ex1, float ex2)
	{
		axis[0] = ax1;
		axis[1] = ax2;
		axis[0].Normalise();
		axis[1].Normalise();

		centre = mp;
		extents[0] = ex1;
		extents[1] = ex2;
	}

	Vec2f centre;
	Vec2f axis[2]; // direction of the vector
	float extents[2]; // how long the axis is
};

void CalculateOOBBCorners(const OOBB2& oob, BoxPoints2& bp);
void CalculateOOBBCorners(const OOBB2& oob, Vec2f f[]);
bool CheckCollision(const OOBB2& oobb1, const OOBB2& oobb2);

#endif // OOBB2_H